#@list()
#define main()

<script type="text/javascript">

function setGridHeight(){
	var winHeight = $("body").height();
	$("#_SYSCONFIG_LIST").jqGrid('setGridHeight', winHeight-170);
}

function refresh(){
	sortListViewResult();
}

function sortListViewResult(index,sortorder){
	
	$("#_SYSCONFIG_LIST").jqGrid('setGridParam',{
		postData: {
			'orderName':index,
			'orderType':sortorder
		}
	}).trigger('reloadGrid');
}

function add(){
  	layer.open({
		type: 2,
		title:'新增配置',
		area: ['400px', '400px'], //宽高
		skin: 'layui-layer-lan',
		content:'#(ctx)/sysconfig/add',
		end:function(){
			refresh();
		}
    });
}

function edit(id){
	
  	layer.open({
		type: 2,
		title:'编辑配置',
		area: ['400px', '400px'], //宽高
		skin: 'layui-layer-lan',
		content:'#(ctx)/sysconfig/edit?id='+id,
		end:function(){
			refresh();
		}
    });
}

function modify(){
	var rowid = $("#_SYSCONFIG_LIST").getGridParam('selarrrow');
	
	if(rowid.length == 1){
		edit(rowid.toString());
	}
	
	if(rowid.length == 0){
		msgbox("请选择要编辑的记录", "warn");
	}
}


function del(){
	var rowid = $("#_SYSCONFIG_LIST").getGridParam('selarrrow');
	
	if(rowid.length !=0){
		layer.confirm('确定要删除选中的记录吗？', {
			btn: ['确定', '取消'], //可以无限个按钮
			btn1: function(index, layero){
	        	$.get("#(ctx)/sysconfig/delete", {
	        		"ids": rowid.toString()
	        	}, function(ret) {
	        		if(ret.state == "ok") {
						top.msgbox(ret.msg, "ok");
						refresh();
					}
	        	}, "json");
			}
		});
	}
	
	if(rowid.length ==0){
		msgbox("请选择要删除的记录", "warn");
	}
}

</script>

<div class="ibox ">
	<div class="ibox-title" style="border:0px;">
	    <form class="form-inline">
	    	#perm("/sysconfig/add")
			<button class="btn btn-success" type="button" onclick="add()"><i class="fa fa-plus"></i> 新增</button>
			#end
			
			#perm("/sysconfig/edit")
			<button class="btn btn-info" type="button" onclick="modify()"><i class="fa fa-paste"></i> 编辑</button>
			#end
			
			#perm("/sysconfig/delete")
			<button class="btn btn-danger" type="button" onclick="del()"><i class="fa fa-remove"></i> 删除</button>
			#end
		</form>
	</div>
         	
	<div class="ibox-content">
		#(script)
	</div>
</div>
#end